<%-- 
    Document   : login_sesi
    Created on : Nov 10, 2011, 3:19:07 PM
    Author     : Renaldo Malau
--%>

<jsp:useBean id="kontrol" scope="application" class="kontroler.kontrolerLogin" />

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

        <%
            String sesiUser = request.getParameter("username");
            String sesiPass = request.getParameter("pass");

            if (!kontrol.otentikasi(sesiUser, sesiPass)) {
                String msg = "UserName atau password SALAH";
                response.sendRedirect("login.jsp?msg=" + msg + "&username=" + sesiUser);
            } else {
                //hapus sesi yang ada
                session.invalidate();

                //buat sesi baru
                session = request.getSession();

                //bikin 2 atribut
                session.setAttribute("sesiUser", sesiUser);
                session.setAttribute("sesiPass", sesiPass);
                response.sendRedirect("resepsionis.jsp");
            }


        %>
    </body>
</html>
